<?php @session_start(); ?>

<?php
@session_start();

include "Connect.php";

$userName = trim($_POST['userName']);
$Password = /*md5(*/trim($_POST['Password'])/*)*/;

if($userName== "" || $Password == ""){
$msg = "Fill in all fields!!";
header("location: index.php?poll=$msg");
}
else{

$sql = mysql_query("SELECT * FROM workers WHERE Username= '$userName' AND pwd='$Password' and Responsibility = 'Administrator' ") or die(mysql_error());   

if(mysql_num_rows($sql) > 0){
$myArray = mysql_fetch_array($sql) or die(mysql_error());
$_SESSION['uName'] = $userName;
$_SESSION['passWd'] = $Password;

$_SESSION['Fname'] = $myArray['Fname'];
$_SESSION['Lname'] = $myArray['Lname'];

include "dataColl.php";
}
else{
$msg = "You have entered wrong credentials, Please try again!!";
header("location: index.php?poll=$msg");
}

}


?> 

